#ifndef _DB_STRUCT_H_
#define _DB_STRUCT_H_

#include <inc/typedef.h>

#include "inc/_oralib.h"

struct LoginLogNode
{
    uint32_t _account_id ;
    std::string _account_name;
    oralib::datetime _login_time;
    oralib::datetime _logout_time;
    std::string _ip;
    uint32_t _port;
    uint32_t _serverid;
    uint32_t _online_time;
};

struct LoginLogModel;
class LoginLogList
{
private:
    std::vector<LoginLogNode> _list;
    LoginLogModel* _model;
    bool _sync;

public:
    LoginLogList();
    void Clean();
    bool AddNode(uint32_t account_id, const char* account_name,
        const oralib::datetime& login_time, const oralib::datetime& logout_time,
        uint32_t online_time,
        const char* ip, uint32_t port, uint32_t serverid);
    uint32_t size()
    {
        return _list.size();
    }

    LoginLogNode& operator[](uint32_t idx)
    {
        return _list.at(idx);
    }
	void SetModel(LoginLogModel* model) {_model = model;}
    bool OpenSync();
    bool CloseSync();
};
#endif // _DB_STRUCT_H_
